// 引入
const path = require("path")

//获取当前文件所在的路径
console.log(process.cwd())

//获取当前文件所在的路径
// dir = directory 目录 C:\Users\ROG\Desktop\拉钩教育\fed-e-task-base-03-01\code
console.log(__dirname) 

//获取当前文件的完整路径 C:\Users\ROG\Desktop\拉钩教育\fed-e-task-base-03-01\code
console.log(__filename) 

//获取文件的扩展名 .js
console.log(path.extname(__filename))

// 获取路径中的目录部分 C:\Users\ROG\Desktop\拉钩教育\fed-e-task-base-03-01\code
console.log(path.dirname(__filename))

//获取路径中的文件名 path.js
console.log(path.basename(__filename));

// 相当于../
const t = path.join(__dirname, '..') 
console.log(t) // C:\Users\ROG\Desktop\拉钩教育\fed-e-task-base-03-01

//将多个路径合并起来
const a = path.join("d:/",'a', 'b')
console.log(a)